package com.tangly.module.vo;

import com.tangly.module.entity.BannerEntity;
import com.tangly.module.enums.BannerIs_deleteEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * created by yehao on 2018/7/24.
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "Banner返回包")
public class AppBannerVO {

    @ApiModelProperty(value = "主键",required = true)
    private Integer id;

    /**
     * 创建时间
     */
    private Date create_time;
    /**
     * 更新时间
     */
    private Date update_time;
    /**
     * 是否删除 枚举
     */
    @ApiModelProperty(value = "是否删除",example = "0:正常，1：删除")
    @NotNull(message = "是否删除不能为空")
    private BannerIs_deleteEnum is_delete;
    /**
     * 文件名
     */
    private String file_name;
    /**
     * 备注信息
     */
    private String info;
    /**
     * 图片路径
     */
    @NotNull(message = "文件不能为空")
    @ApiModelProperty(value = "图片路径",example = "1.png")
    private String url;

    public static AppBannerVO convert(BannerEntity bannerEntity){
        AppBannerVO vo=new AppBannerVO();
        BeanUtils.copyProperties(bannerEntity,vo);
        return vo;
    }

}
